package Utils;


import java.awt.image.BufferedImage;
import java.io.IOException;

import javax.imageio.ImageIO;

import Main.GamePanel;


public class Utilidades {	

	public static boolean colidecircular(float X1, float Y1, float R1,
			float X2, float Y2, float R2) {

		float dx = X1 - X2;
		float dy = Y1 - Y2;
		float sr = R1 + R2;
		float d2 = dx * dx + dy * dy;

		if (d2 < (sr * sr)) {
			return true;
		}

		return false;
	}
	
	
	public static boolean ColisaoRetangular(float X1,float Y1,float X2,float Y2,float X3,float Y3,float X4,float Y4){
		if((X1<X4)&&(X2>X3)&&(Y1<Y4)&&(Y2>Y3)){
			return true;
		}else{
			return false;
		}		
	}

	public static BufferedImage LoadImage(String filename) {
		BufferedImage image = null;


		try {
			image = ImageIO.read(GamePanel.instance.getClass().getResource(filename));

		} catch (IOException e) {
			
			e.printStackTrace();
			System.out.println("erroooooo");
		}

		return image;
	}
	
	
	
	
	
}
